<!-- <template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-notice__immunenotice}"> -->
      <!-- <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> -->
        <!-- <el-form-item>
          <el-input v-model="dataForm.id" placeholder="id" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-button @click="getDataList()">{{ $t('query') }}</el-button>
        </el-form-item> -->
<!--        <el-form-item>-->
<!--          <el-button type="info" @click="exportHandle()">{{ $t('export') }}</el-button>-->
<!--        </el-form-item>-->
<!--        <el-form-item>-->
<!--          <el-button v-if="$hasPermission('notice:immunenotice:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>-->
<!--        </el-form-item>-->
<!--        <el-form-item>-->
<!--          <el-button v-if="$hasPermission('notice:immunenotice:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>-->
<!--        </el-form-item>-->
      <!-- </el-form> -->
      <!-- <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;"> -->
<!--        <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>-->
<!--        <el-table-column prop="id" label="id" header-align="center" align="center"></el-table-column>-->
        <!-- <el-table-column prop="immuneDate" label="防疫日期" header-align="center" align="center"></el-table-column> -->
<!--        <el-table-column prop="immuneConfigId" label="防疫项目id" header-align="center" align="center"></el-table-column>-->
        <!-- <el-table-column prop="immuneName" label="防疫项目" header-align="center" align="center"></el-table-column>
        <el-table-column prop="targetType" label="防疫对象" header-align="center" align="center">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.targetType === 0" size="small">种猪</el-tag>
            <el-tag v-else type="primary" size="small">生长猪</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="type" label="防疫条件" header-align="center" align="center">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.type === 0" size="small">普通防疫</el-tag>
            <el-tag v-if="scope.row.type === 1" size="small">产前防疫</el-tag>
            <el-tag v-if="scope.row.type === 2" size="small">产后防疫</el-tag>
            <el-tag v-if="scope.row.type === 3" size="small">日龄</el-tag>
            <el-tag v-if="scope.row.type === 4" size="small">入场后</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="immuneCount" label="防疫数量" header-align="center" align="center"></el-table-column> -->
<!--        <el-table-column prop="creator" label="创建者" header-align="center" align="center"></el-table-column>-->
        <!-- <el-table-column prop="createDate" label="创建时间" header-align="center" align="center"></el-table-column> -->
<!--        <el-table-column prop="tenantId" label="" header-align="center" align="center"></el-table-column>-->
<!--        <el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">-->
<!--          <template slot-scope="scope">-->
<!--            <el-button v-if="$hasPermission('notice:immunenotice:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>-->
<!--            <el-button v-if="$hasPermission('notice:immunenotice:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>-->
<!--          </template>-->
<!--        </el-table-column>-->
      <!-- </el-table> -->
      <!-- <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle">
      </el-pagination> -->
      <!-- 弹窗, 新增 / 修改 -->
      <!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> -->
    <!-- </div>
  </el-card>
</template> -->

<!-- <script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './immunenotice-add-or-update'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/notice/immunenotice/page',
        getDataListIsPage: true,
        exportURL: '/notice/immunenotice/export',
        deleteURL: '/notice/immunenotice',
        deleteIsBatch: true
      },
      dataForm: {
        id: ''
      }
    }
  },
  components: {
    AddOrUpdate
  }
}
</script> -->





<!-- 防疫提醒 -->
<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="form">
      <el-form :inline="true" :model="formInline">
        <el-form-item label="免疫项目">
          <el-input v-model="formInline.project" placeholder="免疫项目" size="small" clearable></el-input>
        </el-form-item>
        <el-form-item label="免疫对象">
          <el-select v-model="formInline.object" placeholder="免疫对象">
            <el-option v-for="item in object" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit" size="small">查询</el-button>
        </el-form-item>
        <el-form-item>
          <el-button type="warning" size="small" icon="el-icon-plus" @click="showDialog">添加</el-button>
        </el-form-item>
        <el-form-item>
          <el-button type="danger" size="small" icon="el-icon-delete">批量删除</el-button>
        </el-form-item>
      </el-form>
    </div>
    <el-table :data="tableData" style="width: 100%" border>
      <el-table-column type="selection" width="55" align="center">
      </el-table-column>
      <el-table-column prop="time" label="到期时间" align="center">
      </el-table-column>
      <el-table-column prop="project" label="免疫项目" align="center">
      </el-table-column>
      <el-table-column prop="object" label="免疫对象" align="center">
      </el-table-column>
      <el-table-column prop="pigsty" label="猪舍" align="center">
      </el-table-column>
      <el-table-column prop="num" label="需免疫数量" align="center">
      </el-table-column>
      <el-table-column prop="prop" label="操作" align="center">
        <template slot-scope="scope">
          <el-button size="mini" type="primary" icon="el-icon-edit" @click="handleEdit(scope.row)">编辑</el-button>
          <el-button size="mini" type="danger" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
      :page-sizes="[10, 20, 30, 40]" :page-size="10" layout="total, sizes, prev, pager, next, jumper"
      :total="totalRecord">
    </el-pagination>
    <!-- 弹窗 -->
    <Dialog ref="child" :info="info" @updateViews="getData" />
  </el-card>
</template>

<script>
import Dialog from './immunenotice-dialog.vue'
export default {
  components: {
    Dialog
  },
  data() {
    return {
      tableData: [],
      currentPage: 1,//默认显示第一页
      pageSize: 10,//默认每页显示5条数据
      totalRecord: 100,//总数据条数
      formInline: {
        project: '',
        object: '',
      },
      object: [
        {
          value: '生长猪',
          label: '生长猪'
        }, {
          value: '种猪',
          label: '种猪'
        }
      ],
      info: {}
    }
  },
  mounted() {
    this.getData();//列表的数据
  },
  methods: {
    // 列表的数据接口---------
    getData() {
      this.$http.get(`/mmm`).then(({ data: res }) => {
        if (res.code !== 0) {
          return this.$message.error(res.msg);
        }
        this.tableData = res.data
      }).catch(() => { });
    },
    // 新增
    showDialog() {
      this.$refs.child.dialogVisible = true;
      this.info = {
        title: '新增',
        type: 1
      }
      this.$refs.child.immunityForm = {}
    },
    // 编辑
    handleEdit(row) {
      this.$refs.child.dialogVisible = true;
      this.info = {
        title: '修改',
        type: 2
      }
      this.$refs.child.immunityForm = { ...row }
    },
    // 删除接口----------------
    handleDelete(row) {
      this.$confirm(`当前数据很重要，请确定是否删除第 ${index + 1} 行数据？`, "提示",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }
      ).then(() => {
        this.$http.delete(`/ff`, { id: row.id }).then(res => {
          if (res.code == 0) {
            this.$message({
              type: "success",
              message: "删除成功!"
            });
          }
          this.getData();
        });
      }).catch(() => {
        this.$message({
          type: "info",
          message: "已取消删除"
        });
      });
    },
    // 每页条数
    handleSizeChange(val) {
      this.currentPage = 1;
      this.pageSize = val;
    },
    // 当前页
    handleCurrentChange(val) {
      this.currentPage = val
    },
    onSubmit() {
      console.log('submit!', this.formInline);
    }
  }
}
</script>

<style lang="scss" scoped></style>
